<!-- <template>
  <div>
    <table
      border="1"
      width="700"
      style="border-collapse: collapse"
    >
      <caption>
        购物车
      </caption>
      <thead>
        <tr v-for="item in goodList " :key="item.index">
          <th>
            <input type="checkbox" v-model="isAll"/> <span>全选</span>
          </th>
          <th>{{item.name}}</th>
          <th>{{item.price}}</th>
          <th>{{item.num}}</th>
          <th>总价</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        
      </tbody>
      <tfoot>
        <tr>
          <td>合计:</td>
          <td colspan="5">
            
          </td>
        </tr>
      </tfoot>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      goodList: [
        {
          name: "诸葛亮",
          price: 1000,
          num: 1,
          checked: false,
        },
        {
          name: "蔡文姬",
          price: 1500,
          num: 1,
          checked: false,
        },
        {
          name: "妲己",
          price: 2000,
          num: 1,
          checked: false,
        },
        {
          name: "鲁班",
          price: 2200,
          num: 1,
          checked: false,
        },
      ],
    };
  },
  computed:{
    isAll:{
      get(){
        return this.arr.every(item=>item.checked===true)
      },
      set(val){
        this.arr.forEach(item=>item.checked=val)
      }
    }
  }
};
</script>

<style>
</style> -->